package com.asp.alumnisystem.ui;

import android.os.Bundle;
import android.widget.TextView;

import com.asp.alumnisystem.R;
import com.asp.alumnisystem.base.BaseActivity;
import com.asp.alumnisystem.model.NoticeModel;
import com.asp.alumnisystem.utils.TimeUtils;
import com.asp.alumnisystem.view.TitleBar;

import java.io.Serializable;

import butterknife.BindView;

/**
 * 公告详情界面
 */
public class NoticeInfoActivity extends BaseActivity {

    private NoticeModel noticeModel;

    @BindView(R.id.title_bar)
    TitleBar titleBar;
    @BindView(R.id.notice_title)
    TextView titleView;
    @BindView(R.id.notice_temp)
    TextView tempView;
    @BindView(R.id.notice_content)
    TextView contentView;

    @Override
    protected boolean interceptCreate(Bundle savedInstanceState) {
        Serializable serializable = getIntent().getSerializableExtra("model");
        if (serializable != null){
            noticeModel = (NoticeModel) serializable;
        }else{
            return true;
        }
        return false;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.notice_info_layout;
    }

    @Override
    protected void initView() {
        super.initView();
        titleBar.setTitleStr("公告详情");
        titleView.setText(noticeModel.getNoticeTitle());
        contentView.setText(noticeModel.getNoticeContent());
        tempView.setText("发布时间：" + TimeUtils.longTime2String(noticeModel.getCreateTime(), TimeUtils.timePattern2));
    }

    @Override
    public void onBack() {
        finish();
    }
}
